<template>
  <el-card shadow="never">
    <e-table
      ref="eTable"
      @getList="handleGetList"
      :tableData="tableData"
      :columns="columns"
      :loading="loading"
      :total="total"
    />
  </el-card>
</template>

<script>
import { getReportMedicalQualityCore } from '@/api/reports'
export default {
  data() {
    return {
      total: 1,
      loading: false,
      tableData: [],
      columns: [
        {
          label: '账期',
          prop: 'show_month'
        },
        {
          label: '科室',
          prop: 'hmrp_dept_name'
        },
        {
          label: '科室代码',
          prop: 'hmrp_dept_code'
        },
        {
          label: '出院患者人均费用标准值',
          prop: 'per_avg_cost_std'
        },
        {
          label: '出院患者人均费用业务值',
          prop: 'per_avg_cost'
        },
        {
          label: '检查费用比例标准值',
          prop: 'chk_cost_pct_std'
        },
        {
          label: '检查费用比例业务值',
          prop: 'chk_cost_pct'
        },
        {
          label: '治疗费用比例标准值',
          prop: 'treat_cost_pct_std'
        },
        {
          label: '治疗费用比例业务值',
          prop: 'treat_cost_pct'
        },
        {
          label: '药品费用比例标准值',
          prop: 'drug_cost_pct'
        },
        {
          label: '药品费用比例业务值',
          prop: 'drug_cost_pct_assess'
        },
        {
          label: '药品费用比例考核值',
          prop: 'hmrpDeptName'
        },
        {
          label: '材料费用比例标准值',
          prop: 'material_cost_pct_std'
        },
        {
          label: '材料费用比例业务值',
          prop: 'material_cost_pct'
        },
        {
          label: '月出院人次标准值',
          prop: 'out_num_std'
        },
        {
          label: '月出院人次业务值',
          prop: 'out_num'
        },
        {
          label: '床位使用率标准值',
          prop: 'bed_use_rate_std'
        },
        {
          label: '床位使用率业务值',
          prop: 'bed_use_rate'
        },
        {
          label: '平均住院日标准值',
          prop: 'avg_inner_day_std'
        },
        {
          label: '平均住院日业务值',
          prop: 'avg_inner_day'
        },
        {
          label: '抗菌药使用率标准值',
          prop: 'antibac_drug_use_rate_std'
        },
        {
          label: '抗菌药使用率业务值',
          prop: 'antibac_drug_use_rate'
        },
        {
          label: '抗菌药使用强度标准值',
          prop: 'ddd_std'
        },
        {
          label: '抗菌药使用强度业务值',
          prop: 'ddd'
        },
        {
          label: '基本药物占比标准值',
          prop: 'basic_drug_cost_pct_std'
        },
        {
          label: '基本药物金额占比',
          prop: 'basic_drug_cost_pct'
        },
        {
          label: '阳性率标准值',
          prop: 'pos_rate_std'
        },
        {
          label: '阳性率',
          prop: 'pos_rate'
        }
      ],
      queryParam: {
        pageSize: 10,
        pageNo: 1
      }
    }
  },
  methods: {
    //columns 动态删减，根据form传递过来的数据
    async handleGetList(param = {}) {
      this.loading = true
      // this.columns = [
      // ]
      this.queryParam = Object.assign(this.queryParam, param)

      // if (this.queryParam.deptState) {
      //   this.columns.unshift({
      //     label: '科室名称',
      //     prop: 'his_dept_name'
      //   })
      // }
      // if (this.queryParam.dateState) {
      //   this.columns.unshift({
      //     label: '日期',
      //     prop: 'dt'
      //   })
      // }
      const res = await getReportMedicalQualityCore(this.queryParam)
      if (res && res.data.records.length > 0) {
        const {
          state,
          data: { records, total }
        } = res
        this.tableData = records
        this.total = total
      } else {
        this.tableData = []
        this.total = 1
      }
      this.loading = false
    }
  }
}
</script>
